﻿<?php
error_reporting(0);
define('IN_QY',true);
session_start();
require("include/common.inc.php");
define('SCRIPT','ad_list');

?>



<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>母婴商城</title>
        <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
        <meta content="yes" name="apple-mobile-web-app-capable"/>
        <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
        <meta content="telephone=no" name="format-detection"/>
        <link href="/ui/xianzhi/css/style.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src="/ui/xianzhi/js/jquery.min.js"></script>
        <script type="text/javascript" src="/ui/xianzhi/js/slider.js"></script>
        <script type="text/javascript" src="/ui/xianzhi/js/tab.js"></script>
		<script src="dropload.min.js"></script>
		<script type="text/javascript" src="/ui/layer/mobile/layer.js"></script>  
		<style>
		.aui-nav-item {
    display: block;
    -webkit-box-flex: 1;
    -ms-box-flex: 1;
    box-flex: 1;
    -ms-box-sizing: border-box;
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    line-height: 44px;
    text-align: center;
    overflow: hidden;
    font-size: 0.85rem;
    color: #404040;
    border-bottom: 1px solid #f0f0f0;
}
.aui-nav-item-active {
    background-color: transparent;
    color: #ffa013;
    font-size: 0.85rem;
    letter-spacing: 0;
    font-weight: 700;
}
		
		
		  .content{
        max-width: 640px;
        margin: 0 auto;
        background-color: #fff;
    }
		.dropload-up,.dropload-down{
    position: relative;
    height: 0;
    overflow: hidden;
    font-size: 12px;
    /* 开启硬件加速 */
    -webkit-transform:translateZ(0);
    transform:translateZ(0);
}
.dropload-down{
    height: 0px;
}
.aui-shop-list .aui-shop-list-item:nth-child(2n + 1) {float:left}
.aui-shop-list .aui-shop-list-item:nth-child(2n) {float:right}
.dropload-refresh,.dropload-update,.dropload-load,.dropload-noData{
    height: 0px;
    line-height: 50px;
    text-align: center;
}
.dropload-load .loading{
    display: inline-block;
    height: 15px;
    width: 15px;
    border-radius: 100%;
    margin: 6px;
    border: 2px solid #666;
    border-bottom-color: transparent;
    vertical-align: middle;
    -webkit-animation: rotate 0.75s linear infinite;
    animation: rotate 0.75s linear infinite;
}
@-webkit-keyframes rotate {
    0% {
        -webkit-transform: rotate(0deg);
    }
    50% {
        -webkit-transform: rotate(180deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
    }
}
@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(180deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
    .opacity{
        -webkit-animation: opacity 0.3s linear;
        animation: opacity 0.3s linear;
    }
    @-webkit-keyframes opacity {
        0% {
            opacity:0;
        }
        100% {
            opacity:1;
        }
    }
    @keyframes opacity {
        0% {
            opacity:0;
        }
        100% {
            opacity:1;
        }
    }
    i.icon.icon-search {
    margin-top: 6px;
    margin-left: 45px;
}

     

		</style>
    </head>
    <body>
        <section class="aui-flexView">
            <header class="aui-navBar aui-navBar-fixed">
                <a onclick="javascript:history.go(-1);"  class="aui-navBar-item">
                    <i class="icon icon-return"></i>
                </a>
                <div class="aui-center">
                    <span class="aui-center-title">母婴商城</span>
                </div>
                <a href="http://beta3.goodshare.com.cn/wap/mysearch.php" class="aui-navBar-item">
                    <i class="icon icon-search"></i>
                   
                </a>
            </header>
			
            <section class="aui-scrollView">
			
		        <div class="aui-ad-bar">
                    <img src="/ui/image/入驻.jpg" style="width:100%" alt="">
                </div>
				
                <div class="aui-ad-bar">
                    <img src="/ui/image/商城.jpg" style="width:100%" alt="">
                </div>
				

				
			    <nav class="aui-nav-box">
                    <div id="tui" onclick="tui()" class="aui-nav-item aui-nav-item-active">推荐</div>
                    <div  id="news" onclick="news()" class="aui-nav-item">最新</div>
                </nav>
  
			      <div class="content">

                    <div class="aui-shop-list aui-shop-list-selected">

                    </div>
					
					
                </div>	
				
            </section>

        </section>
		
		<script>
			      function news(){
                  var dom2 = document.getElementById('news');
                  var dom3 = document.getElementById('tui');				  
                  $(dom2).toggleClass('aui-nav-item');
                  $(dom3).removeClass('aui-nav-item-active')
                  $(dom2).addClass('aui-nav-item');
                  $(dom2).addClass('aui-nav-item-active');
					layer.open({
                    content: '最新商品加载中...'
                   ,skin: 'msg'
                   ,time: 1 //2秒后自动关闭
                    });	
					
					$(function(){
	$(".aui-shop-list").empty();	
		
    // 页数
    var page = 0;
     $('.content').dropload({
        scrollArea : window,
        loadDownFn : function(me){
            page++;
            // 拼接HTML
            var result = '';
            $.ajax({
                type: 'GET',
                url: 'muyingapi.php?page='+page+'&sname=2',
                dataType: 'json',
                success: function(data){
					
					if(data==0){
						me.lock();
                        // 无数据
                        me.noData();
						  me.resetload();
						$(".dropload-noData").empty();	
					    $(".dropload-load").empty();
					 // layer.open({
                    // content: 'end'
                   // ,skin: 'msg'
                   // ,time: 2 //2秒后自动关闭
                    // });	
					return false;	
					}
					
					   var arrLen = data.data.length;
			
                    if(arrLen > 0){

                        for(var i=0; i<arrLen; i++){
							
                            result += '<a href="/haigou/htspxq.php?fid='+data.data[i].id+'" class="aui-shop-list-item" class="left">'
                             +'<div class="aui-shop-list-item-hd">'
                              + ' <img src="'+data.data[i].img+'" alt="">'
                           +' </div>	'					
                           + '<div class="aui-shop-list-item-bd">'
                               + '<h3>'+data.data[i].title+'</h3>'
                               + '<p class="aui-special-text">'
                               +  '<span>'+data.data[i].enbrand+'</span>'
                               + '</p>'
                              + ' <p class="aui-special-etc">'
                                  + ' <span class="aui-special-etc-hd">￥'+data.data[i].price+'</span>'
                       +'<img src="'+data.data[i].tximg+'" alt="" style="width: 20px;margin-left: 25px;">'
				+' <span style="margin-top: 5px;position: absolute;margin-left: 10px;font-size: 8px;float: right;">'+data.data[i].txname+'</span>'
                   + '</p>'
                           + '</div>'
                       +' </a>'

                        }
                    // 如果没有数据
                    }else{
   						alert('无搜索结果');  
						// 锁定
                        me.lock();
                        // 无数据
                        me.noData();
						

                    }
                        // 插入数据到页面，放到最后面
                        $('.aui-shop-list').append(result);
                        // 每次数据插入，必须重置
                        me.resetload();
							
                
                },
                error: function(xhr, type){
					 layer.open({
                    content: '网络异常，请稍等'
                   ,skin: 'msg'
                   ,time: 2 //2秒后自动关闭
                    });	
					
                    me.resetload();
                }
            });
        }
    });
	
	
	
});		
						
			  }
			  
			  function tui(){
                  var dom3 = document.getElementById('news');
                  var dom2 = document.getElementById('tui');				  
                  $(dom2).toggleClass('aui-nav-item');
                  $(dom3).removeClass('aui-nav-item-active')
                  $(dom2).addClass('aui-nav-item');
                  $(dom2).addClass('aui-nav-item-active');
				  
					layer.open({
                    content: '推荐商品加载中...'
                   ,skin: 'msg'
                   ,time: 1 
                    });	
			
	$(function(){
	$(".aui-shop-list").empty();	
		
    // 页数
    var page = 0;
     $('.content').dropload({
        scrollArea : window,
        loadDownFn : function(me){
            page++;
            // 拼接HTML
            var result = '';
            $.ajax({
                type: 'GET',
                url: 'muyingapi.php?page='+page+'&sname=1',
                dataType: 'json',
                success: function(data){
					
					if(data==0){
						me.lock();
                        // 无数据
                        me.noData();
						  me.resetload();
						$(".dropload-noData").empty();	
					    $(".dropload-load").empty();
					 // layer.open({
                    // content: 'end'
                   // ,skin: 'msg'
                   // ,time: 2 //2秒后自动关闭
                    // });	
					return false;	
					}
					
					   var arrLen = data.data.length;
			
                    if(arrLen > 0){

                        for(var i=0; i<arrLen; i++){
							
                            result += '<a href="/haigou/htspxq.php?fid='+data.data[i].id+'" class="aui-shop-list-item"  class="right">'
                             +'<div class="aui-shop-list-item-hd">'
                              + ' <img src="'+data.data[i].img+'" alt="">'
                           +' </div>	'					
                           + '<div class="aui-shop-list-item-bd">'
                               + '<h3>'+data.data[i].title+'</h3>'
                               + '<p class="aui-special-text">'
                               +  '<span>'+data.data[i].enbrand+'</span>'
                               + '</p>'
                              + ' <p class="aui-special-etc">'
                                  + ' <span class="aui-special-etc-hd">￥'+data.data[i].price+'</span>'
                       +'<img src="'+data.data[i].tximg+'" alt="" style="width: 20px;margin-left: 25px;">'
				+' <span style="margin-top: 5px;position: absolute;margin-left: 10px;font-size: 8px;float: right;">'+data.data[i].txname+'</span>'
                   + '</p>'
                           + '</div>'
                       +' </a>'

                        }
                    // 如果没有数据
                    }else{
   						alert('无搜索结果');  
						// 锁定
                        me.lock();
                        // 无数据
                        me.noData();
						

                    }
                        // 插入数据到页面，放到最后面
                        $('.aui-shop-list').append(result);
                        // 每次数据插入，必须重置
                        me.resetload();
							
                
                },
                error: function(xhr, type){
					
					 layer.open({
                    content: '网络异常，请稍等'
                   ,skin: 'msg'
                   ,time: 2 //2秒后自动关闭
                    });	
					
                    // 即使加载出错，也得重置
                    me.resetload();
                }
            });
        }
    });
	
	
	
});	
		
		

		
			  }			  
			  
			  
			  
		
$(function(){
    // 页数
    var page = 0;
     $('.content').dropload({
        scrollArea : window,
        loadDownFn : function(me){
            page++;
            // 拼接HTML
            var result = '';
            $.ajax({
                type: 'GET',
                url: 'muyingapi.php?page='+page+'&sname=1',
                dataType: 'json',
                success: function(data){
					
					if(data==0){
						me.lock();
                        // 无数据
                        me.noData();
						  me.resetload();
						$(".dropload-noData").empty();	
					    $(".dropload-load").empty();
					 // layer.open({
                    // content: 'end'
                   // ,skin: 'msg'
                   // ,time: 2 //2秒后自动关闭
                    // });	
					return false;	
					}
					
					   var arrLen = data.data.length;
			
                    if(arrLen > 0){

                        for(var i=0; i<arrLen; i++){
							
                            result += '<a href="/haigou/htspxq.php?fid='+data.data[i].id+'" class="aui-shop-list-item"  class="left">'
                             +'<div class="aui-shop-list-item-hd">'
                              + ' <img src="'+data.data[i].img+'" alt="">'
                           +' </div>	'					
                           + '<div class="aui-shop-list-item-bd">'
                               + '<h3>'+data.data[i].title+'</h3>'
                               + '<p class="aui-special-text">'
                               +  '<span>'+data.data[i].enbrand+'</span>'
                               + '</p>'
                              + ' <p class="aui-special-etc">'
                                  + ' <span class="aui-special-etc-hd">￥'+data.data[i].price+'</span>'
                       +'<img src="'+data.data[i].tximg+'" alt="" style="width: 20px;margin-left: 25px;">'
				+' <span style="margin-top: 5px;position: absolute;margin-left: 10px;font-size: 8px;float: right;">'+data.data[i].txname+'</span>'
                   + '</p>'
                           + '</div>'
                       +' </a>'

                        }
                    // 如果没有数据
                    }else{
   						alert('无搜索结果');  
						// 锁定
                        me.lock();
                        // 无数据
                        me.noData();
						

                    }
                        // 插入数据到页面，放到最后面
                        $('.aui-shop-list').append(result);
                        // 每次数据插入，必须重置
                        me.resetload();
							
                
                },
                error: function(xhr, type){
					 layer.open({
                    content: '网络异常，请稍等'
                   ,skin: 'msg'
                   ,time: 2 //2秒后自动关闭
                    });	
                    me.resetload();
                }
            });
        }
    });
	
	
	
});
</script>	

    </body>
</html>
